<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Get pool size for connection pools</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="class.mongopool.html">« MongoPool</a></li>
      <li style="float: right;"><a href="mongopool.info.html">MongoPool::info »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="class.mongopool.html">MongoPool</a></li>
    <li>Get pool size for connection pools</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="mongopool.getsize" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">MongoPool::getSize</h1>
  <p class="verinfo">(PECL mongo &gt;= 1.2.3)</p><p class="refpurpose"><span class="refname">MongoPool::getSize</span> &mdash; <span class="dc-title">Get pool size for connection pools</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-mongopool.getsize-description">
  <h3 class="title">Description</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="modifier">static</span> <span class="methodname"><strong>MongoPool::getSize</strong></span>(): <span class="type">int</span></div>

 </div>


 <div class="refsect1 parameters" id="refsect1-mongopool.getsize-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-mongopool.getsize-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the current pool size.
  </p>
 </div>

 <div class="refsect1 changelog" id="refsect1-mongopool.getsize-changelog">
  <h3 class="title">Changelog</h3>
  <p class="para">
   <table class="doctable informaltable">
    
     <thead>
      <tr>
       <th>Version</th>
       <th>Description</th>
      </tr>

     </thead>

     <tbody class="tbody">
      <tr>
       <td>PECL mongo 1.2.11</td>
       <td>Emits <strong><code>E_DEPRECATED</code></strong> when used.</td>
      </tr>

     </tbody>
    
   </table>

  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-mongopool.getsize-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-198">
   <p><strong>Example #1 Changing pool size</strong></p>
   <div class="example-contents"><p>
    This returns the default pool size, sets a new pool size, then prints the
    new pool size and the pool debugging information.  Note that changing the
    pool size only affects new connection pools, it does not change old ones.
   </p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br />$connection&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Mongo</span><span style="color: #007700">(</span><span style="color: #DD0000">"host1"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;pool&nbsp;size&nbsp;is&nbsp;-1<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"pool&nbsp;size&nbsp;is:&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">MongoPool</span><span style="color: #007700">::</span><span style="color: #0000BB">getSize</span><span style="color: #007700">().</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br />echo&nbsp;</span><span style="color: #DD0000">"setting&nbsp;pool&nbsp;size&nbsp;to&nbsp;200\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">MongoPool</span><span style="color: #007700">::</span><span style="color: #0000BB">setSize</span><span style="color: #007700">(</span><span style="color: #0000BB">200</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;pool&nbsp;size&nbsp;is&nbsp;200<br /></span><span style="color: #007700">echo&nbsp;</span><span style="color: #DD0000">"pool&nbsp;size&nbsp;is:&nbsp;"</span><span style="color: #007700">.</span><span style="color: #0000BB">MongoPool</span><span style="color: #007700">::</span><span style="color: #0000BB">getSize</span><span style="color: #007700">().</span><span style="color: #DD0000">"\n"</span><span style="color: #007700">;<br /><br /></span><span style="color: #0000BB">$conn2&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">Mongo</span><span style="color: #007700">(</span><span style="color: #DD0000">"host2"</span><span style="color: #007700">);<br /><br /></span><span style="color: #FF8000">//&nbsp;remaining&nbsp;for&nbsp;host1&nbsp;is&nbsp;-2<br />//&nbsp;remaining&nbsp;for&nbsp;host2&nbsp;is&nbsp;199<br /></span><span style="color: #0000BB">var_dump</span><span style="color: #007700">(</span><span style="color: #0000BB">Mongo</span><span style="color: #007700">::</span><span style="color: #0000BB">poolDebug</span><span style="color: #007700">());<br /><br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-mongopool.getsize-seealso">
  <h3 class="title">See Also</h3>
  <p class="para">
   <ul class="simplelist">
    <li class="member"><span class="function"><a href="mongopool.setsize.html" class="function" rel="rdfs-seeAlso">MongoPool::setSize()</a> - Set the size for future connection pools</span></li>
    <li class="member"><span class="function"><a href="mongopool.info.html" class="function" rel="rdfs-seeAlso">MongoPool::info()</a> - Returns information about all connection pools</span></li>
    <li class="member">The <a href="mongo.connecting.html" class="link">connection</a> documentation.</li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>